package cn.lingyangwl.agile.pay.pay.model.bo;

import cn.lingyangwl.agile.pay.model.entity.MchApp;
import cn.lingyangwl.agile.pay.model.entity.MchInfo;
import lombok.Data;

import java.util.Map;
import java.util.concurrent.ConcurrentHashMap;

/**
 * 商户配置信息
 * 放置到内存， 避免多次查询操作
 *
 * @author shenguangyang
 */
@Data
public class MchInfoConfigContext {


    /**
     * 商户信息缓存
     */
    private String mchNo;
    private String mchType;
    private MchInfo mchInfo;
    private Map<String, MchApp> appMap = new ConcurrentHashMap<>();

    /**
     * 重置商户APP
     */
    public void putMchApp(MchApp mchApp) {
        appMap.put(mchApp.getId(), mchApp);
    }

    /**
     * get商户APP
     */
    public MchApp getMchApp(String appId) {
        return appMap.get(appId);
    }

}
